package com.sc.auction.pay.Controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sc.auction.common.util.R;
import com.sc.auction.pay.pojo.Orders;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lsc
 * @since 2020-09-05
 */
@RestController
@RequestMapping("/pay/orders")
public class OrdersController {
    @Autowired
    com.sc.auction.pay.Service.OrdersService ordersService;

    @PutMapping("updateOrder")
    @ApiOperation("修改订单")
    public R updateOrder(Orders orders){
        if(orders!=null){
            QueryWrapper queryWrapper = new QueryWrapper();
            queryWrapper.eq("id",orders.getId());
            boolean update = ordersService.update(orders, queryWrapper);
                if(update){
                    return R.ok().message("修改订单成功");
                }else{
                    return R.error().message("修改订单失败");
                }
        }
        return R.error().message("没有查询到该订单的信息");
    }

}

